package com.hly.utils;

import java.util.HashMap;

public class XmlBean {
    private String name;
    private String content;
    private String fullContent;
    private String fullContentTemp;
    private String writePath;

    private HashMap<String, String> keyValueMap = new HashMap<String, String>();

    public XmlBean() {
        super();
    }


    public XmlBean(String action, String name, String content, String fullContent) {
        this.name = name;
        this.content = content;
        this.fullContent = fullContent;
        if (name.contains("<(!-CustomTag-!)>")) {
            throw new RuntimeException("name不能包含<(!-CustomTag-!)>");
        }
        fullContentTemp = fullContent.replace(content, getTag());
        if ("getStringXmlBean".equals(action)) {
            System.out.println(fullContent);
//            System.out.println("XmlBean  " + fullContent);
        } else {
//            System.out.println("来源于：" + action + "------     " + fullContent);
        }
//        System.out.println("fullContentTemp=" + fullContentTemp);
        if (fullContent.contains("%s")) {
            FyUtils.fuhaoList.add(fullContent);
        }
        keyValueMap.put(name, fullContent);
    }

    public String getFullContentTemp() {
        return fullContentTemp;
    }

    public void setFullContentTemp(String fullContentTemp) {
        this.fullContentTemp = fullContentTemp;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getFullContent() {
        return fullContent;
    }

    public String getTag() {
        return "<(!-CustomTag-!)>";
    }

    public String getCustomContent() {
        return "<(!-CustomContent-!)>";
    }

    public void setFullContent(String fullContent) {
        this.fullContent = fullContent;
    }

    @Override
    public String toString() {
        return fullContent;
    }


    public String getWritePath() {
        return writePath;
    }

    public void setWritePath(String writePath) {
        this.writePath = writePath;
    }

    public HashMap<String, String> getKeyValueMap() {
        return keyValueMap;
    }

    public boolean isContainerKey(String key) {
        return keyValueMap.containsKey(key);
    }
}
